/**
 *  Copyright 2009-2010 Steven Ottenhoff (Dual-IT)
 * 
 *  This file is part of Clazzified.
 *
 *  Clazzified is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  Clazzified is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with Clazzified.  If not, see http://www.gnu.org/licenses/gpl.
 * 
 */

package nl.dualit.clazzified.core.model.attribute.constraint;

public enum ConstraintTypes {

	MINLENGTH( "MINLENGTH", "Minimum length of attribute." ),
	MAXLENGTH( "MAXLENGTH", "Maximum length of attribute." ),
	MINVALUE( "MINVALUE", "Minimum value of attribute." ),
	MAXVALUE( "MAXVALUE", "Maximum value of attribute." ),
	EQUAL( "EQUAL", "Attribute must match constraints." ),
	NOTEQUAL( "NOTEQUAL", "Attribute must not match constraint." );
	
	private final String typeName;
	private final String description;
	
	ConstraintTypes( String typeName, String description ){
		
		this.typeName = typeName;
		this.description = description;
		
	}
	
	public String typeName() { return typeName; }
	public String description() { return description; }
	
	public static ConstraintTypes getType( String typeName ){
		
		for( ConstraintTypes type : ConstraintTypes.values() )
			if( type.typeName.equals( typeName ) )
				return type;
		
		return null;
	}
	
}
